type TupleToUnion<T> = T extends [infer P, ...infer U] ? TupleToUnion<U> | P : never

type a = TupleToUnion<[123, '456', true]>